unit Entity;

interface

uses Types, DGLE;

type
  TEntity = class(TObject)
  private
    FPos: TPoint;
    FName: string;
    FID: Integer;
    procedure SetPos(const Value: TPoint);
    function GetPos: TPoint;
    procedure SetName(const Value: string);
    procedure SetID(const Value: Integer);
  public
    Texture: ITexture;
    constructor Create(X, Y, ID: Integer; TexFName: AnsiString; R: IResourceManager);
    destructor Destroy; override;
    procedure SetPosition(const X, Y: Integer);
    property Pos: TPoint read GetPos write SetPos;
    property Name: string read FName write SetName;
    property ID: Integer read FID write SetID;
  end;

implementation    

{ TEntity }

constructor TEntity.Create(X, Y, ID: Integer; TexFName: AnsiString; R: IResourceManager);
begin
  Name := '';
  Texture := nil;
  Self.ID := ID;
  Self.SetPosition(X, Y);
  R.Load(PAnsiChar(TexFName), IEngineBaseObject(Texture), TEXTURE_LOAD_DEFAULT_2D);
end;

destructor TEntity.Destroy;
begin
  Texture := nil;
  inherited;
end;

function TEntity.GetPos: TPoint;
begin
  Result := FPos;
end;

procedure TEntity.SetID(const Value: Integer);
begin
  FID := Value;
end;

procedure TEntity.SetName(const Value: string);
begin
  FName := Value;
end;

procedure TEntity.SetPos(const Value: TPoint);
begin
  FPos := Value;
end;

procedure TEntity.SetPosition(const X, Y: Integer);
begin
  Pos := Point(X, Y);
end;

end.
